/*------------------------------------------------------------------------------
 * Copyright 2012 NCR Corporation
 *------------------------------------------------------------------------------
 * All revision information is updated automatically from source code control
 * change records - please do not manually edit.
 *------------------------------------------------------------------------------
 *
 * $LastChangedRevision:: 1605                                     $
 * $LastChangedBy:: rb250096                                       $
 * $LastChangedDate:: 2012-02-22 22:52:22 -0500 (Wed, 22 Feb 2012) $
 */

package com.ncr.nep.dashboardcore.rest.client;

/**
 * Exception thrown by a {@link JSONCallback} object because of a JSON-specific
 * error such as malformed JSON or a response with the wrong
 * <code>Content-Type</code> header.
 * 
 * @author rb250096
 * @version $Revision: 1605 $
 */
public class JSONCallbackException extends RuntimeException {
	
	//--------------------------------------------------------------------------
    //
    //  Fields
    //
    //--------------------------------------------------------------------------
	
    /**
	 * Serialization ID.
	 */
	private static final long serialVersionUID = 1L;

    /**
     * The text of the response that caused the JSON error.
     */
    protected String responseText;

	//--------------------------------------------------------------------------
    //
    //  Constructors
    //
    //--------------------------------------------------------------------------

    /**
     * Constructor
     */
    public JSONCallbackException() {
    }

    /**
     * Constructor
     *
     * @param s The exception error message.
     */
    public JSONCallbackException(String s) {
        super(s);
    }

    /**
     * Constructor
     *
     * @param s The exception error message.
     * @param throwable Throwable that caused the exception.
     */
    public JSONCallbackException(String s, Throwable throwable) {
        super(s, throwable);
    }

    /**
     * Constructor
     *
     * @param s The exception error message.
     * @param responseText The response text that caused the JSON error.
     * @param throwable Throwable that caused the exception.
     */
    public JSONCallbackException(String s,
                                 String responseText,
                                 Throwable throwable) {
        super(s, throwable);
        this.responseText = responseText;
    }
    
    /**
     * Constructor
     *
     * @param throwable Throwable that caused the exception.
     */
    public JSONCallbackException(Throwable throwable) {
        super(throwable);
    }

    //--------------------------------------------------------------------------
    //
    //  Properties
    //
    //--------------------------------------------------------------------------

    /**
     * Gets the response text that caused the JSON error.
     *
     * @return The JSON response text.
     */
    public String getResponseText() {
        return this.responseText;
    }
}
